/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "SalesOrder")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SimpleSalesOrder.findAll", query = "SELECT s FROM SimpleSalesOrder s"),
    @NamedQuery(name = "SimpleSalesOrder.findByCustomer", query = "SELECT s FROM SimpleSalesOrder s WHERE s.custId = ?1 ORDER BY s.sOId DESC")})
public class SimpleSalesOrder implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "SOId")
    private Integer sOId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SOCust")
    private int custId;
    
    public SimpleSalesOrder() {
    }

    public SimpleSalesOrder(Integer sOId) {
        this.sOId = sOId;
    }

    public SimpleSalesOrder(Integer sOId, int custId) {
        this.sOId = sOId;
        this.custId = custId;
    }

    public Integer getSOId() {
        return sOId;
    }

    public void setSOId(Integer sOId) {
        this.sOId = sOId;
    }

    public int getCustId() {
        return custId;
    }

    public void setCustId(int custId) {
        this.custId = custId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sOId != null ? sOId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalesOrder)) {
            return false;
        }
        SimpleSalesOrder other = (SimpleSalesOrder) object;
        if ((this.sOId == null && other.sOId != null) || (this.sOId != null && !this.sOId.equals(other.sOId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.SimpleSalesOrder[ sOId=" + sOId + " ]";
    }
}
